package com.micro.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.micro.entity.TrainMealOrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TrainMealOrderItemRepository extends BaseMapper<TrainMealOrderItem> {
    
    // 根据订单ID查询订单明细
    @Select("SELECT * FROM 火车餐订单明细 WHERE 订单ID = #{orderId}")
    List<TrainMealOrderItem> findByOrderId(@Param("orderId") Long orderId);
    
    // 根据餐食ID查询订单明细
    @Select("SELECT * FROM 火车餐订单明细 WHERE 餐食ID = #{mealId}")
    List<TrainMealOrderItem> findByMealId(@Param("mealId") Long mealId);
}
